using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class GiaoDich_XemGiaoDichPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            lblMaHoaDon.Text = Request.QueryString["MaHoaDon"].ToString();
            ds.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
            ds.SelectCommand = "HoaDon_Master_GetByMaHoaDon";
            ds.SelectParameters.Clear();
            ds.SelectParameters.Add(new Parameter("mahoadon"));
            ds.SelectParameters["mahoadon"].DefaultValue = lblMaHoaDon.Text;

            DataTable rs = ((DataView)ds.Select(System.Web.UI.DataSourceSelectArguments.Empty)).ToTable();
            if (rs != null)
            {
                lblMaHoaDon.Text = rs.Rows[0]["MaHoaDon"].ToString();
                
                try
                {
                    cboLoaiGiaoDich.SelectedValue = rs.Rows[0]["LoaiGiaoDich"].ToString();
                    lblLoaiGiaoDich.Text = cboLoaiGiaoDich.SelectedItem.Text;
                }
                catch (Exception loai)
                {
                    string err = loai.Message;
                }
                txtNgayXuat.Text= rs.Rows[0]["NgayXuat"].ToString();
                txtNgayXuatThucTe.Text= rs.Rows[0]["NgayXuatThucTe"].ToString();
                txtNgayNhan.Text= rs.Rows[0]["NgayNhan"].ToString();
                txtNgayNhanThucTe.Text= rs.Rows[0]["NgayNhanThucTe"].ToString();
                txtNoiDung.Text = rs.Rows[0]["NoiDung"].ToString();
                lblKhoXuat.Text = rs.Rows[0]["KhoXuat"].ToString();
                lblNguoiXuat.Text = rs.Rows[0]["UserXuat"].ToString();
                lblKhoNhan.Text = rs.Rows[0]["KhoNhan"].ToString();
                try
                {
                    lblUserNhan.Text = rs.Rows[0]["UserNhan"].ToString();
                    lblUserNhan.Text = lblUserNhan.Text.Substring(0, lblUserNhan.Text.IndexOf(":_:"));
                }
                catch { }
            }
        }

    }
    protected void cboKhoNhan_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
